package com.gaogzhen.feigh;

import com.gaogzhen.config.feign.OAuth2FeignConfig;
import com.gaogzhen.dto.UserDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 * @version 1.0
 * @description
 * @date 2022-10-29 11:49
 */
@FeignClient(name = "member-service", configuration = OAuth2FeignConfig.class, path = "/users")
public interface UserServiceFeign {
    /**
     * 远程调用
     *  量查询用户的简要信息
     * @param ids   用户id集合
     * @param username  用户名
     * @param mobile    手机号
     * @return      用户简要信息集合
     */
    @GetMapping("/brief/users")
    Map<Long, UserDto> getBriefUsers(
            @RequestParam(value = "ids", required = false) List<Long> ids,
            @RequestParam(value = "username", required = false) String username,
            @RequestParam(value = "mobile", required = false) String mobile);

    /**
     * 远程调用
     *  查询某个用户的信息
     * @param id   用户id
     * @return      用户简要信息集合
     */
    @GetMapping("/userInfo/{id}")
    UserDto getUserById(@PathVariable Long id);
}
